the value being cast (Rhs is the first argument to Checked)
the target type of the cast
The result of the cast operation.
1 auto x = checked!WithNaN(422); 2 assert((cast(ubyte) x) == 255); 3 x = checked!WithNaN(-422); 4 assert((cast(byte) x) == -128); 5 assert(cast(short) x == -422); 6 assert(cast(bool) x); 7 x = x.init; // set back to NaN 8 assert(x != true); 9 assert(x != false);
If rhs is WithNaN.defaultValue!Rhs, returns WithNaN.defaultValue!Lhs. Otherwise, returns cast(Lhs) rhs.